package com.gang.mars.basic.map;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author gang.chen
 * @description
 * @Date 2022/8/15 12:48
 */
public class TestBanana02 {

    public static void main(String[] args) {

        Map<Object, Banana01> map = new ConcurrentHashMap<>();

        Banana01 b1 = new Banana01("gang.chen");

        Banana01 b2 = new Banana01("lei.chen");

        map.put(1, b1);

        map.put(2, b2);

        Banana01 banana01 = map.computeIfAbsent(3, key -> new Banana01("fang.chen"));

        System.out.println(banana01);

    }
}
